<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">

        <ui:define name="content">
            <h:form>
           
            </h:form>
            <br/>
             <h:form prependId="false">
            <p:panel header="SalesForecasts for Year #{expectedYearOnYearGrowthEntityController.selected.yearOfSales} (#{expectedYearOnYearGrowthEntityController.selected.forecastPeriodType}) with Predicted YOY growth of #{expectedYearOnYearGrowthEntityController.selected.growthRate} %" id="SalesForecast" toggleable="true">
               
                       
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    
                    <p:dataTable id="salesLeadHistoryInquiries" 
                                 value="#{expectedYearOnYearGrowthEntityController.selected.salesForecast}" 
                                 var="item" style="border:solid 1px"
                                 > 
                        
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Month" />  
                            </f:facet>  
                            <h:outputText value="#{item.monthOfSales}" />  
                        </p:column>
                        
                            
                         <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="#{expectedYearOnYearGrowthEntityController.selected.yearOfSales-1} Sales figure" />  
                            </f:facet>  
                            <h:outputText value="#{item.previousYearBase}" />  
                        </p:column> 
                        
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Base Projection" />  
                            </f:facet>  
                            <h:outputText value="#{item.baseProjection}" />  
                        </p:column>
                         
                         <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Monthly Adjust" />  
                            </f:facet>  
                            <h:outputText value="#{item.monthlyGrowthAdjustment}" />  
                        </p:column> 
                          
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Adjusted Base Projection" />  
                            </f:facet>  
                            <h:outputText value="#{item.adjustedBaseProjection}" />  
                        </p:column> 
                        
                         <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Promotions" />  
                            </f:facet>  
                            <h:outputText value="#{item.expectedMonthlyPromo}" />  
                        </p:column> 
                         <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Forecast" />  
                            </f:facet>  
                            <h:outputText value="#{item.forecast}" />  
                        </p:column> 
<!--                        <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                            <p:commandButton value="View" update="display"   image="ui-icon ui-icon-folder-open" oncomplete="salesForecastDialog.show()" rendered="#{loginBacking.viewAllSalesForecast}">
                                    <f:setPropertyActionListener value="#{item}"  
                                                                 target="#{salesForecastEntityController.salesForecast}" /> 
                        </p:commandButton>
                        </p:column>-->
                        
                        <p:column rendered="#{loginBacking.editSalesForecast or loginBacking.viewAllSalesForecast}">  
                                <p:menuButton value="Options" >  
                                    <p:menuitem value="Analysis" ajax="false" rendered="#{item.archived==false and loginBacking.viewAllSalesForecast}" icon="ui-icon ui-icon-search"
                                                action="#{salesForecastEntityController.analysis(item)}"/> 
                                    <p:menuitem value=" Update" ajax="false" icon="ui-icon ui-icon-disk" 
                                                action="#{salesForecastEntityController.change(item)}" rendered="#{loginBacking.editSalesForecast}"/>
                                     <p:menuitem value="View" update="display"   icon="ui-icon ui-icon-folder-open" oncomplete="salesForecastDialog.show()" rendered="#{loginBacking.viewAllSalesForecast}">
                                    <f:setPropertyActionListener value="#{item}"  
                                                                 target="#{salesForecastEntityController.salesForecast}" /> 
                                 </p:menuitem>
                                                 
                                </p:menuButton>    
                        </p:column>
                        
        
                        
                        
                    </p:dataTable>
                
                
             
  
<h:commandLink>  
    <p:graphicImage value="/images/pdf.png" />  
    <p:dataExporter type="pdf" target="salesLeadHistoryInquiries" fileName="SalesForecasts" excludeColumns="7" preProcessor="#{export.preProcessPDF}"/>  
</h:commandLink>  
  
<h:commandLink>  
    <p:graphicImage value="/images/csv.png" />  
    <p:dataExporter type="csv" target="salesLeadHistoryInquiries" fileName="SalesForecasts" excludeColumns="7" />  
</h:commandLink>  
  
<h:commandLink>  
    <p:graphicImage value="/images/xml.png" />  
    <p:dataExporter type="xml" target="salesLeadHistoryInquiries" fileName="SalesForecasts" excludeColumns="7" />  
</h:commandLink>  
                                <p:dialog header="Sales Forecast Detail" widgetVar="salesForecastDialog" resizable="false"  
                                  width="325" showEffect="explode" hideEffect="explode" >  

                            <h:panelGrid id="display" columns="2" cellpadding="4">  
                                <h:outputText value="ID "/>
                                <h:outputText value="#{salesForecastEntityController.salesForecast.id}"/>
                                <h:outputText value="Created By "/>
                                <h:outputText value="#{salesForecastEntityController.salesForecast.createdBy.firstName}"/>
                                <h:outputText value="Created On "/>
                                <h:outputText value="#{salesForecastEntityController.salesForecast.createdAt}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>

                                <h:outputText value="Modified By "/>
                                <h:outputText value="#{salesForecastEntityController.salesForecast.lastModifiedBy.firstName}"/>

                                <h:outputText value="Modified ON "/>
                                <h:outputText value="#{salesForecastEntityController.salesForecast.lastModifiedAt}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>

                                

                            </h:panelGrid>  
                        </p:dialog>
                
                
                   
                    
                    
                    <br />
                   
                 
               
            </p:panel>
             <p:commandButton value="Back" action="#{expectedYearOnYearGrowthEntityController.prepareList}" />
            </h:form>
            
        </ui:define>
    </ui:composition>

</html>
